package com.cuit.mimall.controller.api;

import com.cuit.mimall.common.R;
import com.cuit.mimall.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author star
 * @folder API
 */
@RestController
@RequestMapping("/api/v1/menu")
public class MenuController {
    private final IMenuService menuService;

    @Autowired
    public MenuController(IMenuService menuService) {
        this.menuService = menuService;
    }

    /**
     * 超管权限设置接口
     * 超管获取所有接口权限
     * TODO 未完成
     */
    @GetMapping("/super")
    @PreAuthorize("hasAnyAuthority('ROLE_SUPER')")
    public R<?> getAllInterfacePermissionsForSuperAdmin() {
        return menuService.superPermissionsSetting();
    }
}
